using System;
using System.Drawing;
using System.Windows.Forms;
using Sunny.UI;

namespace LiteTools.forms
{
    public partial class TlvViewer : UIForm
    {
        public TlvViewer(int width, int height, string tlvContent)
        {
            InitializeComponent();
            Width = width;
            Height = height;
            tlv_viewer.Width = width - 8;
            tlv_viewer.Height = height - 44;
            tlv_viewer.Location = new Point(4, 40);
            tlv_viewer.Text = tlvContent;
        }

        private void tlv_viewer_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Close();
            }
        }

        private void TlvViewer_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Close();
            }
        }

        private void tlv_viewer_DoubleClick(object sender, EventArgs e)
        {
            Clipboard.SetText(tlv_viewer.Text);
            UIMessageTip.ShowOk("内容复制成功！");
        }
    }
}